//
//  MenuJingXuanCollectionViewCell.m
//  Products_B
//
//  Created by lanou on 16/6/4.
//  Copyright © 2016年 朋学友. All rights reserved.
//

#import "MenuJingXuanCollectionViewCell.h"

@implementation MenuJingXuanCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.picImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, kWidth/ 2 -1, kWidth /2-1)];
        self.iconImageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, kWidth/ 2 +10, 50, 50)];
        self.iconImageView.layer.cornerRadius = 25;
        self.iconImageView.layer.masksToBounds = YES;
        self.nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(60, kWidth/2 + 10, 100, 20)];
        self.nameLabel.font = [UIFont systemFontOfSize:14];
        self.timeLabel = [[UILabel alloc]initWithFrame:CGRectMake(60, kWidth/2 + 10 + 30, 100, 20)];
        self.timeLabel.font = [UIFont systemFontOfSize:12];
        self.timeLabel.textColor = [UIColor grayColor];
        self.countLabel = [[UILabel alloc]initWithFrame:CGRectMake(kWidth/2 - 30 - 30-20, kWidth/2 + 10 + 30, 30, 20)];
        self.countLabel.font = [UIFont systemFontOfSize:13];
        self.countLabel.textColor = [UIColor grayColor];
//        self.countLabel.backgroundColor = [UIColor magentaColor];
        self.countLabel.textAlignment = NSTextAlignmentRight;
        self.zanButton = [UIButton buttonWithType:(UIButtonTypeSystem)];
        self.zanButton.frame = CGRectMake(kWidth/2 - 20 - 30, kWidth / 2 + 30, 30, 30);
        self.zanButton.backgroundColor = [UIColor magentaColor];
        [self.contentView addSubview:_iconImageView];
        [self.contentView addSubview:_picImageView];
        [self.contentView addSubview:_nameLabel];
        [self.contentView addSubview:_timeLabel];
        [self.contentView addSubview:_countLabel];
        [self.contentView addSubview:_zanButton];
        
    }
    return self;
}
- (void)setModel:(MenuJingXuanModel *)model{
    _model = model;
    [self.picImageView sd_setImageWithURL:[NSURL URLWithString:model.image] placeholderImage:nil completed:nil];
    [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:model.head_img] placeholderImage:nil completed:nil];
    self.nameLabel.text = model.nick;
    self.timeLabel.text = model.create_time;
    self.countLabel.text = model.agree_count;
}
@end
